package com.jike.noobmoney.adapter;


import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;

import com.jike.noobmoney.R;
import com.jike.noobmoney.contants.ConstantValue;
import com.jike.noobmoney.entity.InviteListEntity;
import com.jike.noobmoney.helper.ImageLoader;


/**
 * Created by kekex on 2018/9/8.
 * 首页Performer的列表adapter
 */

public class InviteListAdapter extends BaseRecyclerAdapter<InviteListEntity.UserinvitelistBean> {


    private Context context;

    public InviteListAdapter(Context context) {
        super(R.layout.item_invite_list);
        this.context = context;

    }

    @Override
    protected void onBindViewHolder(SmartViewHolder holder, InviteListEntity.UserinvitelistBean item, int position) {

        ImageView photo = (ImageView) holder.findViewById(R.id.iv_user_photo);
        if (item.getAvatar() != null) {
            String url = ConstantValue.IMG_BASEURL + item.getAvatar();
            ImageLoader.displayImageDefaultHead(context, url, photo);
        } else {
            ImageLoader.displayImageDefaultHead(context, R.drawable.ic_user_default, photo);
        }

        holder.text(R.id.tv_nickname, TextUtils.isEmpty(item.getNick()) ? "小白赚钱" : item.getNick());
        holder.text(R.id.tv_phone, item.getMobile());
    }
}
